home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: March 17th, 1998
- // Author: GG
- //
- // Description:
- // addRecentFile, used currently used by Project Viewer.
- // adds filenames to the recent file list.
- //
-
-
-
- global proc addRecentFile ( string $theFile, string $theType )
- {
- string $RecentFilesList[];
- int $i;
- int $nNum;
- int $maxNum;
-
- $maxNum = `optionVar -q "RecentFilesMaxSize"`;
-
- if (!`optionVar -exists "RecentFilesList"`)
- {
- if ( $maxNum > 0 ) {
- optionVar -sva "RecentFilesList" $theFile;
- optionVar -sva "RecentFilesTypeList" $theType;
- }
- if (catch(melCallbackAddRecentFile($theFile)))
- warning("Error in melCallbackAddRecentFile()");
- return;
- }
-
- // get the list
- $RecentFilesList = `optionVar -q "RecentFilesList"`;
- $nNum = size($RecentFilesList);
-
- if ($nNum > 0 )
- {
- if ( !`optionVar -exists "RecentFilesTypeList"`)
- {
- initRecentFilesTypeList( $RecentFilesList );
- }
-
- // search for name in the list.
- for ($i = 0; $i < $nNum; $i++)
- {
- if ($RecentFilesList[$i] == $theFile)
- {
- // move it to the top.
- optionVar -rfa "RecentFilesList" $i;
- optionVar -rfa "RecentFilesTypeList" $i;
- optionVar -sva "RecentFilesList" $theFile;
- optionVar -sva "RecentFilesTypeList" $theType;
- if (catch(melCallbackAddRecentFile($theFile)))
- warning("Error in melCallbackAddRecentFile()");
- return;
- }
- }
- }
-
- // not found, append at the end.
- optionVar -sva "RecentFilesList" $theFile;
- optionVar -sva "RecentFilesTypeList" $theType;
- $nNum = `optionVar -arraySize "RecentFilesList"`;
- if ( $nNum > $maxNum ) // default maximum size
- {
- for ( $i = 0; $i < $nNum - $maxNum; $i++ )
- {
- // remove the oldest one.
- optionVar -rfa "RecentFilesList" 0;
- optionVar -rfa "RecentFilesTypeList" 0;
- }
- }
- if (catch(melCallbackAddRecentFile($theFile)))
- warning("Error in melCallbackAddRecentFile()");
- }
-